package cn.skyquant.quant4j.service.boot.model.ylzc;

import cn.skyquant.quant4j.sdk.enums.Status;
import cn.skyquant.quant4j.sdk.enums.YlzcType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface YlzcRepository extends CrudRepository<Ylzc, Integer> {

    Page<Ylzc> findBySymbolAndPeriodAndType(String symbol, Integer period, YlzcType type, Pageable pageable);
    Page<Ylzc> findBySymbolAndPeriodAndTypeAndLevel(String symbol, Integer period, YlzcType type,Integer level, Pageable pageable);
    @Query("select u from Ylzc u where u.symbol=?1 and period=?2 and status=?3 and  thedate between ?4 and ?5 ")
    List<Ylzc> findBySymbolAndTime(String symbol, Integer period, Status status, Date begin, Date end, Sort sort);
}
